<?php
/**
 * @Author: lianlianzan(13040@qq.com)
 * @Date:   2018-08-18 16:40:16
 * @Last Modified by:   lianlianzan
 * @Last Modified time: 2020-11-07 16:55:05
 * 后台逻辑层基类
 */

namespace app\admin\logic;
use app\common\logic\Base as BaseLogic;

class AdminLogic extends BaseLogic {

	//依赖的应用对应的类型标识
	const DEPEND_APP_TYPE = [
		'module' => 1,
		'plugin' => 2,
		'theme'  => 3
	];

	//依赖的应用对应的类型
	const DEPEND_TYPE_APP = [
		1=>'module',
		2=>'plugin',
		3=>'theme'
	];

	public $currentUser = [];
	public $uid = 0;
	public $adminUid = 0;

	protected function initialize() {
		parent::initialize();
		//$this->currentUser = session('admin_login_auth');
		//$this->uid = $this->adminUid = is_admin_login();
	}

	/**
	 * 校验当前用户是否允许同时登录
	 * @return   [type]                    [description]
	 * @Author   lianlianzan(13040@qq.com)
	 * @DateTime 2020-11-07
	 */
	public static function checkAllowLoginByTime() {
		if (config('admin_allow_login_many')==1) {
			return true;
		} elseif (session('admin_activation_auth_sign') == model('admin/AdminUser')->where('uid',is_admin_login())->value('activation_auth_sign')) {
			return true;
		}
		return false;
	}
	
}